Conversation
This was referenced Aug 8, 2026
pull Bot
pushed a commit
to gaylonalfano/ai
that referenced
this pull request
Aug 11, 2026
…t in tool loops (vercel#18515) ## Background The published @ai-sdk/open-responses package lost assistant reasoning when its generated content was replayed in a tool loop, sending zero reasoning items after parsing one. ## Root Cause The assistant-content switch in convertToOpenResponsesInput handled only text and tool-call parts, so parsed reasoning parts fell through without serialization; the offline reproduction confirmed one reasoning part was read and zero were sent. ## Summary Assistant reasoning parts are now serialized as Open Responses reasoning items with reasoning_text content. The request type was tightened accordingly, and a patch changeset was added. ## Testing Added regression coverage asserting that assistant reasoning becomes a correctly shaped reasoning input item. ## End-to-end Validation - `pnpm -C packages/open-responses build`; `pnpm -C examples/ai-functions exec tsx src/reproduction/issue-18513-open-responses-reasoning-round-trip.ts` — the offline round trip sent one reasoning item instead of zero and exited successfully. ## Related Issues Fixes vercel#18513 Closes vercel#18514 Closes vercel#18546 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: Astro-Han <255364436+Astro-Han@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
@ai-sdk/open-responsesparsed provider reasoning items into assistantreasoningparts, but silently dropped those parts when the assistant output was replayed in a subsequent tool-loop request.The live-provider investigation in #18512 captured the missing reasoning item, but DeepSeek accepted that request when its provider-issued tool call ID was retained. The provider-free reproduction in #18514 isolated the serialization defect independently of that provider behavior.
Summary
reasoning_textcontent.@ai-sdk/open-responses.End-to-End Verification
Ran the provider-free two-step reproduction:
pnpm -C examples/ai-functions exec tsx src/reproduction/issue-18511-open-responses-reasoning-round-trip.tsIt completed successfully with the expected second-request ordering:
Verification
pnpm --filter @ai-sdk/open-responses testpnpm --filter @ai-sdk/open-responses buildpnpm --filter @example/ai-functions type-checkpnpm checkpnpm type-check:fullChecklist
pnpm changesetin the project root)Related Issues
Fixes #18511
Fixes #18513
Closes #18512
Closes #18514
Closes #18515
Co-authored by Co-authored-by: Astro-Han 255364436+Astro-Han@users.noreply.github.com